import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 87111
 * Date: 2025-10-31
 * Time: 12:56
 */
public class Demo1 {
    private volatile static int flag = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            while(flag == 0) {

            }
        });
        Thread t2 = new Thread(() -> {
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入flag值：");
            flag = sc.nextInt();
        });
        t1.start();
        t2.start();
    }
}
